<?php if (!defined('THINK_PATH')) exit();?><div class="col-md-9 common-list" style="display:none">
	<div style="width:100%;height:90px;"></div>
	<div class="panel panel-default" style="margin-top:10px;">
		<div class="panel-heading">
		  <h4 class="panel-title">
			<a class="accordion-toggle data-parent="#accordion">公共版块</a>
			<i class="oa-post pull-right"></i>
		  </h4>
		</div>
		<div id="collapseOne" class="panel-collapse collapse in">
		  <div class="panel-body">

	<!-- Nav tabs -->
	<ul class="nav nav-tabs">
		<li class="active"><a href="#alltopic" id="0" data-toggle="tab">所有话题</a></li>
		<?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><li><a href="#<?php echo ($vo["target"]); ?>" id="<?php echo ($vo["category_id"]); ?>" data-toggle="tab"><?php echo ($vo["category_name"]); ?></a></li><?php endforeach; endif; else: echo "" ;endif; ?>
	</ul>

	<!-- Tab panes -->
	<div class="tab-content topic" style="padding-top:20px;">
		<div class="tab-pane fade in active users" id="alltopic">
			<div class="user-list">
				<ul class="list-group">
					<?php if(is_array($topiclist)): $i = 0; $__LIST__ = $topiclist;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i; if($vo["topic_categoryid"] == 2): else: ?>
					<li class="list-group-item tooltips" data-placement="left" data-toggle="tooltip" data-original-title="【<?php echo ($vo["category_name"]); ?>】 回复/浏览:<?php echo ($vo["comment"]); ?>/<?php echo ($vo["view"]); ?>">
						<a href="" title="新窗口打开"><i class="folder_common pull-left"></i></a>
						<span class="pull-left">【<?php echo ($vo["now_department_name"]); ?>:<?php echo ($vo["name"]); ?>】</span>
						<a class="pull-left topic-title" id="<?php echo ($vo["topic_id"]); ?>" title="<?php echo ($vo["topic_title"]); ?>" content="<?php echo ($vo["topic_content"]); ?>"><?php echo ($vo["topic_title"]); ?></a>
						<span class="pull-right">最后发表:<i><?php echo ($vo["create_time"]); ?></i></span>
					</li><?php endif; endforeach; endif; else: echo "" ;endif; ?>
				</ul>
				<?php echo ($page); ?>
			</div>
		</div>
		<?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><div class="tab-pane fade" id="<?php echo ($vo["target"]); ?>">
			<?php $category_id = $vo["category_id"]; ?>
			<ul class="list-group">
			<?php if(is_array($topiclist)): $i = 0; $__LIST__ = $topiclist;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$topic): $mod = ($i % 2 );++$i; if($topic["topic_categoryid"] == $category_id): if($topic["topic_categoryid"] == 2): if($topic["owner_uid"] == $uid): ?><li class="list-group-item tooltips" data-placement="left" data-toggle="tooltip" data-original-title="【<?php echo ($topic["category_name"]); ?>】 回复/浏览:<?php echo ($topic["comment"]); ?>/<?php echo ($topic["view"]); ?>">
							<a href="" title="新窗口打开"><i class="folder_common pull-left"></i></a>
							<span class="pull-left">【<?php echo ($topic["now_department_name"]); ?>:<?php echo ($topic["name"]); ?>】</span>
							<a class="pull-left topic-title" id="<?php echo ($topic["topic_id"]); ?>" title="<?php echo ($topic["topic_title"]); ?>"><?php echo ($topic["topic_title"]); ?></a>
							<span class="pull-right">最后发表:<i><?php echo ($topic["create_time"]); ?></i></span>
						</li>
						<?php else: endif; ?>
					<?php else: ?>
					<li class="list-group-item tooltips" data-placement="left" data-toggle="tooltip" data-original-title="【<?php echo ($topic["category_name"]); ?>】 回复/浏览:<?php echo ($topic["comment"]); ?>/<?php echo ($topic["view"]); ?>">
						<a href="" title="新窗口打开"><i class="folder_common pull-left"></i></a>
						<span class="pull-left">【<?php echo ($topic["now_department_name"]); ?>:<?php echo ($topic["name"]); ?>】</span>
						<a class="pull-left topic-title" id="<?php echo ($topic["topic_id"]); ?>" title="<?php echo ($topic["topic_title"]); ?>"><?php echo ($topic["topic_title"]); ?></a>
						<span class="pull-right">最后发表:<i><?php echo ($topic["create_time"]); ?></i></span>
					</li><?php endif; ?>
				<?php else: endif; endforeach; endif; else: echo "" ;endif; ?>
			</ul>
		</div><?php endforeach; endif; else: echo "" ;endif; ?>
	</div>

		  </div>
		</div>
	</div>
</div>
<script>
	$(function(){
		$(".tooltips").tooltip();
		$(".oa-post").click(function(){
			$("#topic").modal('show');
			$(".publish_topic").unbind('click').click(function(){
				html = editor4.html();
				var topic_title = getInputValueByName('topic_title'),
					category_id = $("select[name='category_id']").val();
				if(html == "" || topic_title == "" || category_id == "0"){
					$.globalMessenger().post("填入信息不能为空");
					return;
				}
				$.post('__APP__/Topic/postTopic',{topic_content:html,topic_title:topic_title,category_id:category_id},function(json){
					$.globalMessenger().post(json.info);
					if(json.status == 1){
						$("#topic").modal('hide');
						MP('__APP__/Topic/index','common-list')
						document.getElementById("topic-post-form").reset(); 
						editor4.html("");
					}
				});
			});
		});
		$(".topic .topic-title").click(function(){
			var topic_id = $(this).attr("id");
			var title = $(this).attr("title");
			topicDisplay(title,'__APP__/Topic/topic',topic_id);
		});
	});
</script>